package stack;

public class Stack {

    private int[] stack;
    private int num;

    public Stack() {
        this.stack = new int[100];
        this.num = 0;
    }

    public Stack(int pDimensione) {
        this.stack = new int[pDimensione];
        this.num = 0;
    }

    public int pop() {
        int valore=0;
        if(this.num!=0){
        valore = this.stack[this.num];
        this.stack[this.num] = 0;
        this.num--;
        }
        return valore;
    }

    public void push(int pValore) {
        this.stack[this.num] = pValore;
    }
    public int[] getStack(){
        return this.stack;
    }
    public void empty(){
        for(int i=0; i<this.stack.length; i++){
            this.stack[i]=0;
        }
    }
}
